<?php ini_set("memory_limit","32M"); ?>
<script type="text/javascript">
		function report_pdf(){		      
 
            var site 		= "<?php echo site_url()?>";
			var periode		= "<?php echo $periode;?>";
			var kode_wil	= "<?php echo $kode_wil;?>";
			var jenis_kb	= "<?php echo $jenis_kb;?>";
			
			var buat_nama 	= document.getElementById('buat_nama').value;
			var buat_nip 	= document.getElementById('buat_nip').value;
			var buat_jabatan 	= document.getElementById('buat_jabatan').value;
			
			var periksa_nama 	= document.getElementById('periksa_nama').value;
			var periksa_nip 	= document.getElementById('periksa_nip').value;
			var periksa_jabatan 	= document.getElementById('periksa_jabatan').value;
			
			
			var ketahui_nama 	= document.getElementById('ketahui_nama').value;
			var ketahui_nip 	= document.getElementById('ketahui_nip').value;
			var ketahui_jabatan 	= document.getElementById('ketahui_jabatan').value;
			
			var kirim = buat_nama+'~'+buat_nip+'~'+buat_jabatan+'~'+periksa_nama+'~'+periksa_nip+'~'+periksa_jabatan+'~'+ketahui_nama+'~'+ketahui_nip+'~'+ketahui_jabatan;
			alert (kirim);
			document.forms["myform"].submit();
			location.href = site+"/piutang_pajak_per_wilayah/report_pdf_langsung/"+periode+'/'+kode_wil+'/'+jenis_kb+'/'+kirim;

		}
	</script>

 
<link href="<?=base_url()?>asset/admin/css/style.css" rel="stylesheet" type="text/css">

			<div id="tab-settings" class="tabs-content"> 
			 <!--<form name="myform" action="<?=base_url()?>/index.php/piutang_pajak_per_wilayah/report_pdf_langsung">-->
			 <?
				$attributes = array('name' => 'myform', 'id' => 'myform', 'class'=>'block-content form');
				echo form_open_multipart('piutang_pajak_per_wilayah/report_pdf_langsung', $attributes);
			?>	
				<div class="colx3-left" style="margin-top:10px;">
					<label for="complex-en-url"><b>Dibuat Oleh  :</b></label>
					<p> 
						<span class="relative">
							<label for="complex-en-url">Nama (*) :</label>
							<input type="text" name="buat_nama" id="buat_nama"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<label for="complex-en-url">NIP (*) :</label>
							<input type="text" name="buat_nip" id="buat_nip"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<label for="complex-en-url">Jabatan (*) :</label>
							<input type="text" name="buat_jabatan" id="buat_jabatan"   value="" class="duapertiga-width">
						</span>	
					</p>
				</div  >
				<div  class="colx3-center" style="margin-top:10px;">
					<label for="complex-en-url"><b>Diperiksa Oleh  :</b></label>
					<p> 
						<span class="relative">
							<label for="complex-en-url">Nama (*) :</label>
							<input type="text" name="periksa_nama" id="periksa_nama"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<label for="complex-en-url">NIP (*) :</label>
							<input type="text" name="periksa_nip" id="periksa_nip"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<label for="complex-en-url">Jabatan (*) :</label>
							<input type="text" name="periksa_jabatan" id="periksa_jabatan"   value="" class="duapertiga-width">
						</span>	
					</p>
				</div>
				<div  class="colx3-right" style="margin-top:10px;">
					<label for="complex-en-url"><b>Diketahui Oleh  :</b></label>
					<p> 
						<span class="relative">
							<label for="complex-en-url">Nama (*) :</label>
							<input type="text" name="ketahui_nama" id="ketahui_nama"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<label for="complex-en-url">NIP (*) :</label>
							<input type="text" name="ketahui_nip" id="ketahui_nip"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<label for="complex-en-url">Jabatan (*) :</label>
							<input type="text" name="ketahui_jabatan" id="ketahui_jabatan"   value="" class="duapertiga-width">
						</span>	
					</p>
				</div>	
					
					<button type="submit" onclick="report_pdf()"><img src="<?=base_url()?>asset/admin/images/icons/fugue/tick-circle.png" width="16" height="16">REKAP PDF</button>
			 </form>		 
			</div>	


<div id="div_laporan">

	<table class="laporan" width="90%" border="1">

		<tr><td colspan="6"><b>Dinas Pendapatan Daerah Provinsi Kalimantan Timur</b></td></tr>

		<tr><td colspan="6"><b>JL. Mayjen M.T Haryono Samarinda</b></td></tr>

		<tr><td colspan="6"><b>TELP </b></td></tr>

		<tr><td colspan="6"><b></b><br/></td></tr>

		<tr><td colspan="6" div align="center"><b>LAPORAN PIUTANG PAJAK PER WILAYAH</b></td></tr>

		<tr><td colspan="6"><b>Periode : <?=$periode?></b></td></tr>

		<tr><td colspan="6"><b>Wilayah : <?=$kode_wil?> - <?=$kode_wilvalue?></b></td></tr>
		
		<tr><td colspan="6"><b>Jenis Kendaraan : <?=$jenis_kb?> - <?=$jenis_kbvalue?></b></td></tr>
		<tr>
			<th scope="col">NO</th>
			<th scope="col">WILAYAH</th>
			<th scope="col">JENIS</th>
			<th scope="col">PIUTANG PAJAK</th>
			<th scope="col">YANG SUDAH BAYAR</th>
			<th scope="col">SISA PAJAK</th> 
		</tr>

		

		<?php 
					$i=0;
					$j=0;
					$sum_piutang = 0; 
					$sum_sudah_bayar = 0; 
					$sum_sisa = 0; 
				//	$row = $getItemCount->num_rows();
					
					foreach($getItemCount->result() as $row) {$j=$j+1; } 
					$getItemCount = $j;
					//echo $getItemCount; echo '<<'; echo '<br/>';
					
					
					for($x=0;$x<=$getItemCount-1;$x++){
					
					$i = $i+1;
					//foreach($piutang->result() as $row1)echo $row1->piutang;echo'<br/>';echo'<br/>';
					//foreach($sudah_bayar->result_array() as $row2) echo $row2[1]['sudah_bayar'];echo'<br/>';
					
					$row1 = $results->result_array(); 
						//echo $x.'-'. $row1[$x]['kd_wilayah'].'-'.$row1[$x]['nm_wilayah'].'-'.$row1[$x]['kd_jenis_kb'].'-'.$row1[$x]['uraian'];  
					$row2 = $piutang->result_array(); 
						//echo $x.'-'. $row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.$row2[$x]['piutang'];  
					$row3 = $sudah_bayar->result_array();
						//echo $x.'-'. $row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'. $row3[$x]['sudah_bayar'];echo'<br/>'; 
					?>
					<tr>
						<td align="left" valign="top"><?=$i?> </td>
						<td align="left" valign="top"><?=$row1[$x]['kd_wilayah'];?> - <?=$row1[$x]['nm_wilayah'];?> </td>
						<td align="left" valign="top"><?=$row1[$x]['kd_jenis_kb'];?> - <?=$row1[$x]['uraian'];?> </td>
						<td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row2[$x]['piutang']);?></td>
						<td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row3[$x]['sudah_bayar']);?> </td>
						<td align="right" valign="top"><?=convert_rupiah_non_rp(($row2[$x]['piutang']-$row3[$x]['sudah_bayar']));?> </td>
						
					</tr>	
					<?
						$sum_piutang = $sum_piutang + $row2[$x]['piutang']; 
						$sum_sudah_bayar = $sum_sudah_bayar + $row3[$x]['sudah_bayar']; 
						$sum_sisa = $sum_sisa + ($row2[$x]['piutang']-$row3[$x]['sudah_bayar']); 
					}
					?>
					<tr>
							<td colspan="3"><b>JUMLAH : </b></td> 
							<td align="right"><b><?=convert_rupiah_non_rp($sum_piutang);?></b></td>
							<td align="right"><b><?=convert_rupiah_non_rp($sum_sudah_bayar);?></b></td>
							<td align="right"><b><?=convert_rupiah_non_rp($sum_sisa);?></b></td>
							 
						</tr>	
					  
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>					
			 	 
	</table>

</div>  